/*
 * =====================================================================================
 *
 *       Filename:  test_copy_elide_nvo.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/10/2011 12:48:07 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Chen Ken (Ken), zlchen.ken@gmail.com
 *        Company:  EMC
 *
 * =====================================================================================
 */

#include <vector>
#include <iostream>

using namespace std;

class A
{
public:
	A() { cout << "A::A()" << ++cnt << "\n" ; }
	~A() { cout << "A::~A()\n"; }
	A( const A& a) { cout << "A::A( const A& a)\n"; }

private:
	const static int siz = 1024;
	char buf[siz];

private:
	static int cnt;
};

int A::cnt = 0; 

vector<A> createAs( void )
{
  vector<A> vA;
	vA.reserve(10);
  for( int i = 0; i < 10; ++i )
	{
		vA.push_back( A() );
	}

	cout << "before return from createAs\n" ;
	return vA;
}

void printAs( vector<A> vA )
{
	cout << "printAs\n";
}

int main( int argc, char* argv[] )
{
  vector<A> vA = createAs();
	
	cout << "after return from createAs\n" ;

	printAs( createAs() );

	return 0;
}

